package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbTypeTemplateMapper;
import com.dongdong.pojo.TbTypeTemplate;
import com.dongdong.pojo.TbTypeTemplateExample;
import com.dongdong.service.TypeTemplateService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class TypeTemplateServiceImpl implements TypeTemplateService {

    @Autowired
    private TbTypeTemplateMapper templateMapper;

    @Override
    public List<TbTypeTemplate> selectAll(String name) {
        List<TbTypeTemplate> templateList = templateMapper.selectAllName(name);
        return templateList;
    }

    @Override
    public boolean insert(TbTypeTemplate tbTypeTemplate) {
        int i = templateMapper.insertSelective(tbTypeTemplate);
        return i > 0;
    }

    @Override
    public boolean delete(Long id) {
        int i = templateMapper.deleteByPrimaryKey(id);
        return i > 0;
    }

    @Override
    public TbTypeTemplate selectId(Long id) {
        TbTypeTemplate tbTypeTemplate = templateMapper.selectByPrimaryKey(id);
        return tbTypeTemplate;
    }

    @Override
    public boolean update(TbTypeTemplate tbTypeTemplate) {
        int i = templateMapper.updateByPrimaryKeySelective(tbTypeTemplate);
        return i > 0;
    }

    @Override
    public List<TbTypeTemplate> selecta() {
        List<TbTypeTemplate> templateList = templateMapper.selectByExample(null);
        return templateList;
    }

    @Override
    public TbTypeTemplate selectTypeId(Long id) {
        TbTypeTemplate tbTypeTemplate = templateMapper.selectByPrimaryKey(id);
        return tbTypeTemplate;
    }
}
